package com.lnsf.bookstore.system.coupon.controller;

import com.github.pagehelper.PageInfo;
import com.lnsf.bookstore.system.coupon.service.CouponService;
import com.lnsf.bookstore.system.coupon.vo.Coupon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/coupon")
public class CouponController {

    @Autowired
    private CouponService couponService;

    /**
     * 查看所有列表
     */
    @RequestMapping(value = "/list",method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseBody
    public Object queryByUid(@RequestParam Map<String, Object> params) {
        params.put("user_id",10);
        params.put("pageSize",10);
        PageInfo<Coupon> pageInfo = couponService.queryAll(params);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("errno",0);
        map.put("result",pageInfo);
        return map;
    }
}
